<!--
 * @Description: 动态组件
 * @Author: zzj
 * @Date: 2021-10-12 10:38:36
 * @LastEditors: zzj
 * @LastEditTime: 2021-10-12 20:08:53
-->
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>动态组件</title>
	<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>
</head>
<body>
	<div id="app">
		<div>
			<button @click="current='person-component'">个人</button>
			<button @click="current='compony-component'">企业</button>
		</div>
		<div>
			<component :is="current"></component>
			<!-- <person-component></person-component>
			<compony-component></compony-component> -->
		</div>
	</div>
	<script>
		let personComponent ={
			template:`
				<div>个人...</div>
			`
		}
		let componyComponent = {
				template: `
				<div>企业...</div>
			`
			}

		new Vue({
			el:"#app",
			data:{
				current:"person-component"
			},
			components:{
				"person-component": personComponent,
				"compony-component":componyComponent
			}
		})
	</script>
</body>
</html>